package cn.zm.trip.web.vo;

import cn.zm.trip.web.domain.Hotel;
import cn.zm.trip.web.domain.HotelFacility;
import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.Objects;

/**
 * 酒店VO
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class HotelVO {

    /**
     * 酒店基础信息
     */

    private Integer hid;

    private String title;

    private String local;

    private String houseType;

    private String bedType;

    private String phone;

    private Integer peopleNum;

    private String zip;

    private String houseSize;

    private Integer price;

    private String imgUrl;

    private String content;

    /**
     * 酒店图片列表
     */
    private List<String> pictureList;

    /**
     * 酒店评分 0 非常差，1 较差，2 一般，3 非常好，4 极佳
     */
    private Integer score;


    /**
     * 酒店设施信息
     */

    //酒店id
    private Integer hotelId;

    // 免费停车
    private boolean freeParking;

    // 游泳池
    private boolean swimmingPool;

    // 商务中心
    private boolean businessCenter;

    // 无线网络
    private boolean wirelessNetwork;

    // 健身房
    private boolean tennisCourt;

    // 会议室
    private boolean meetingRoom;


    /**
     * 构建HotelVO
     */
    public static HotelVO buildHotelVO(Hotel hotel,HotelFacility hotelFacility){
        HotelVO hotelVO = new HotelVO();
        if (Objects.nonNull(hotel)){
            BeanUtils.copyProperties(hotel,hotelVO);
            hotelVO.setPictureList(JSON.parseArray(hotel.getPictureUrls(),String.class));
        }
        if (Objects.nonNull(hotelFacility)){
            BeanUtils.copyProperties(hotelFacility,hotelVO);
        }
        return hotelVO;
    }
}
